import {
  list
} from '../../api/shop.js';
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    shopList: [],
    from:{}
  },

  /**
   * 组件的方法列表
   */
  attached(){
    this.loadList()
  },
  methods: {
    loadList(){
      var _this = this
      list().then(res => {
          _this.data.shopList = res.data
          _this.data.from = res.data[0]
          _this.setData({
            from:_this.data.from,
            shopList:_this.data.shopList
          })
      })
  },
  chooseClick(data) {
      console.log(data)
      var _this = this
      _this.data.shopIndex = data.currentTarget.dataset.index
      _this.data.from = data.currentTarget.dataset.item
      _this.setData({
        from:_this.data.from,
        shopIndex:_this.data.shopIndex
      })
  },
  completeClick(){
      var from={
          from:this.data.from,
          shopIndex:this.data.shopIndex
      }
      console.log(from)
      this.triggerEvent("completeSite", from)
  },
  cencleClick(){
    this.triggerEvent("cencleSite")
  }
  }
})
